<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get("/index","Index\IndexController@index");  //客户登录
    Route::post("/login","Index\IndexController@customerLogin");  //执行客户登录
    Route::get("/customerLogout","Index\IndexController@customerLogout");  //客户退出登录
    Route::get("/register","Index\IndexController@customerRegister");//客户注册
    Route::post("/registers","Index\IndexController@customerRegisters");//执行客户注册

    Route::get("/adminLogin","Admin\AdminController@adminLogin");  //员工登录
    Route::get("/adminLogout","Admin\AdminController@adminLogout");  //员工退出登录
    Route::post("/adminLogin","Admin\AdminController@adminLogins");  //执行员工登录
    Route::get("/adminRegister","Admin\AdminController@adminRegister");//员工注册
    Route::post("/adminRegisters","Admin\AdminController@adminRegisters");  //员工注册申请


    //员工登录
    Route::group(['middleware' => ['LoginAdminCheck']], function () {
        //老总
        Route::get("/searchEmployee","Admin\SearchEmployeeController@searchEmployee");  //查看员工页面
        Route::get("/areaManage","Admin\areaManageController@areaManage");  //查看区域
        Route::post("/addArea","Admin\areaManageController@addArea");  //添加区域
        Route::get("/areaManages/{area_id}","Admin\areaManageController@areaManages");//查看区域详情
        Route::post("/upArea","Admin\areaManageController@upArea");  //添加区域
        Route::get("/delArea","Admin\areaManageController@delArea");  //删除区域

        Route::get("/checkEmployee","Admin\SearchEmployeeController@checkEmployee");  //审查员工页面
        Route::post("/checkEmployees","Admin\SearchEmployeeController@checkEmployees");  //执行审查员工通过
        Route::post("/delcheckEmployees","Admin\SearchEmployeeController@delcheckEmployees");  //执行审查员工未通过

        Route::get("/searchMoney","Admin\MoneyController@searchMoney"); //老总财务统计
        Route::get("/test","Admin\MoneyController@test"); //老总财务统计

        //区域经理
        Route::get("/areaMaster.searchEmployee","AreaMaster\AreaMasterController@searchEmployee");  //区域经理查看员工页面
        Route::get("/areaMaster.checkEmployee","AreaMaster\AreaMasterController@checkEmployee");  //区域经理审查员工页面
        Route::post("/areaMaster.checkEmployees","AreaMaster\AreaMasterController@checkEmployees");  //区域经理执行审查员工通过
        Route::post("/areaMaster.delcheckEmployees","AreaMaster\AreaMasterController@delcheckEmployees");  //执行审查员工未通过

        Route::get("/areaMaster.searchMoney","AreaMaster\AreaMoneyController@searchMoney"); //区域经理财务统计

        Route::get("/areaMaster.searchTask","AreaMaster\AreaTaskController@searchTask"); //区域经理任务管理
        Route::get("/areaMaster.searchTasks/{task_id}","AreaMaster\AreaTaskController@searchTasks"); //区域经理任务详情管理
        Route::post("/areaMaster.taskToEmployee","AreaMaster\AreaTaskController@taskToEmployee"); //区域经理指派任务到员工


        //普通员工
        Route::get("/employee.searchAreaTask","Employee\EmployeeTaskController@searchAreaTask"); //员工查看区域任务
        Route::get("/employee.searchAreaTasks/{task_id}","Employee\EmployeeTaskController@searchAreaTasks"); //员工查看区域任务详情
        Route::post("/employee.employeeToTask","Employee\EmployeeTaskController@employeeToTask"); //员工领取任务
        Route::get("/employee.searchMyTask","Employee\EmployeeTaskController@searchMyTask"); //员工查看已接任务
        Route::get("/employee.searchMyTasks/{task_id}","Employee\EmployeeTaskController@searchMyTasks"); //员工查看已结任务详情
        Route::post("/employee.complateTask","Employee\EmployeeTaskController@complateTask"); //员工完成任务
    });


    //客户登录
    Route::group(['middleware' => ['LoginCustomerCheck']], function () {
        Route::get("/start","Index\CustomerTaskController@searchTask");  //客户任务页面
        Route::get("/moreTask/{task_id}","Index\CustomerTaskController@moreTask");  //客户任务详情页面
        Route::post("/uploadTask","Index\CustomerTaskController@uploadTask");  //客户发布任务
        Route::get("/delTask","Index\CustomerTaskController@delTask");  //客户删除任务
        Route::post("/addEva","Index\CustomerTaskController@addEva"); //客户添加评价
    });

});
